﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace KL.UFrame.Data.Entities
{
    public class Venue:CurdEntityBase
    {
        [Required]
        [StringLength(100)]
        public string Name { get; set; }

        [Required]
        [StringLength(100)]
        public string Purpose { get; set; }

        [Required]
        public int Area { get; set; }

        [Required]
        public int Capacity { get; set; }

        [Required]
        [StringLength(100)]
        public string Devices { get; set; }

        [StringLength(200)]
        public string ImageUrl { get; set; }

        [StringLength(200)]
        public string FrontImageUrl { get; set; }
    }
    

    public class VenueBookRecord
    {
        public int Id { get; set; }

        [Required]
        [Range(201605, 309901)]
        public int Month { get; set; }

        [Required]
        public int VenueId { get; set; }

        [ForeignKey("VenueId")]
        public Venue Venue { get; set; }

        [Required]
        [StringLength(50)]
        public string BookName { get; set; }

        [Required]
        [StringLength(11)]
        public string BookPhone { get; set; }

        [Required]
        [StringLength(500)]
        public string BookReason  { get; set; }

        [Required]
        public DateTime BookTime { get; set; }

        [Required]
        public VenueBookRecordStatus Status { get; set; }

        [StringLength(200)]
        public string StatusDescription { get; set; }

        public virtual IList<VenueBookRecordDuration> Durations { get; set; }

    }

    public enum VenueBookRecordStatus
    {
        New=0,
        Pass=1,
        Failed=2
    }

    public class VenueBookRecordDuration
    {
        public int Id { get; set; }

        public int RecordId { get; set; }

        [ForeignKey("RecordId")]
        public VenueBookRecord VenueBookRecord { get; set; }

        [Required]
        public DateTime Day { get; set; }

        [Required]
        public VenueBookRecordDurationType Duration { get; set; }
    }

    public enum VenueBookRecordDurationType
    {
        am=0,
        pm=1
    }
}